﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;

namespace PlanningGIS.Win.Controls
{
    /// <summary>
    /// 数据库连接配置
    /// </summary>
    public partial class FrmConnect : Office2007Form
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public FrmConnect()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 加载窗体
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmConnect_Load(object sender, EventArgs e)
        {
            cmbDbTypes.Items.AddRange(new string[]{
                "Oracle","Access" 
            });
            cmbDbTypes.SelectedIndex = 0;
        }
        
        /// <summary>
        /// 选择数据库类型
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmbDbTypes_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (cmbDbTypes.Text)
            {
                case "Sql":
                case "Oracle":
                    tbctl.SelectedTab = tbitmDb;
                    break;
                case "Access":
                case "文件数据库":
                case "个人数据库":
                    tbctl.SelectedTab = tbitmLocal;
                    break;
            }
        }

        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// 检查输入的信息是否正确
        /// </summary>
        /// <returns></returns>
        private bool CheckValue()
        {
            if (tbctl.SelectedTab == tbitmDb)
            {

            }
            else
            {

            }
            return true;
        }

        /// <summary>
        /// 取消
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.Close();
        }

        private void btnOpen_Click(object sender, EventArgs e)
        {

        }
    }
}
